/*
 * Copyright 2010 Michael Nitsche
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.mnit.schnipsel.swt.dialog;

import org.eclipse.swt.widgets.Composite;

import de.mnit.basis.swt.anw.A_MN_Dialog;
import de.mnit.basis.swt.anw.A_MN_Gruppe;
import de.mnit.basis.swt.element.S_SWT_Komponente;
import de.mnit.basis.swt.element.steuer.SWT_Fortschritt;
import de.mnit.basis.swt.element.steuer.rollbar.gruppe.bild.deko.SWT_Fenster;
import de.mnit.basis.swt.element.steuer.rollbar.gruppe.bild.deko.S_Fenster;
import de.mnit.basis.swt.grafik.icon.direkt.ICON;
import de.mnit.basis.swt.layout.LayoutAbsolut;

/**
 * @author Michael Nitsche
 * 17.03.2007	Erstellt
 *
 * TODO, Warum ist der schliessbar und minimierbar und z.B. der Login-Dialog nur Schliessbar?
 */
public class Dialog_Fortschritt extends A_MN_Dialog<Dialog_Fortschritt, Boolean> {

	public static void main(String[] par)  { start(Dialog_Fortschritt.class, "Demo"); }


	private final SWT_Fortschritt k_anzeige = new SWT_Fortschritt(false);
	private final String titel;
	private int pos=0;


	public Dialog_Fortschritt(String titel) {
		this.titel=titel;
	}


	// SETZEN

	public void setze(int min, int max) {
		this.k_anzeige.sMinMax(min, max);
		this.pos=min;
		this.t.k_anzeige.sWert(this.pos);
	}

	public void weiter() {
		pos++;
		this.t.k_anzeige.sWert(this.pos);
	}

	public void setze(int pos) {
		this.pos=pos;
	}

	// ERSTELLEN

	protected S_SWT_Komponente<?, ? extends Composite> layout() {
		return LayoutAbsolut.neu()
			.sKomponente(t.k_anzeige).sLORU(10,10,10,null).fertig()
		;
	}

	protected void initStyle() {
	}

	protected void initEvents() {
	}

	protected S_Fenster<?> fenster(A_MN_Gruppe<?> instanz) {
		return SWT_Fenster.neu(instanz, true, 200, 50, this.titel, ICON._16.AKTION_AKTUALISIEREN);
	}

	protected Boolean gErgebnis2() {
		return null;
	}

}
